﻿using System.Windows;
using httpExplorer.ViewModel;

namespace httpExplorer
{
    /// <summary>
    /// This application's main window.
    /// </summary>
    public partial class MainWindow : Window
    {
        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            Closing += (s, e) => ViewModelLocator.Cleanup();
        }

        private void SettingsButtonClicked(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Visibility = Visibility.Collapsed;
            SettingsLayoutRoot.Visibility = Visibility.Visible;
        }

        private void ToolButtonClicked(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Visibility = Visibility.Visible;
            SettingsLayoutRoot.Visibility = Visibility.Collapsed;
            Properties.Settings.Default.Save();
        }

        private void Window_Closed(object sender, System.EventArgs e)
        {
            Properties.Settings.Default.Save();
        }
    }
}